<template>
  <div class="wrap">
    <div class="chain-left">
      <div class="content">
        <div class="key">
          <div style="margin-right: 6px">同期环比</div>
          <i class="el-icon-caret-bottom" style="color: #63DC27;"></i>
        </div>
        <div class="val">{{ realtime.todayElectricityCompare }}%</div>
      </div>
    </div>
    <div class="chain-right">
      <div class="content">
        <div class="key">
          <div style="margin-right: 6px">同期环比</div>
          <i class="el-icon-caret-top" style="color: #DC3725;"></i>
        </div>
        <div class="val">{{ realtime.monthElectricityCompare }}%</div>
      </div>
    </div>
    <div class="cell-1">
      <div class="item">
        <div class="count">{{ realtime.areaEnergy }}</div>
        <div class="icon"></div>
        <div class="desc">单位面积能耗</div>
      </div>
      <div class="item">
        <div class="count">{{ realtime.personEnergy }}</div>
        <div class="icon"></div>
        <div class="desc">人均能耗</div>
      </div>
    </div>
    <div class="cell-2">
      <div class="item">
        <div class="count">{{ realtime.todayElectricity }}</div>
        <div class="icon"></div>
        <div class="desc">当日用电</div>
      </div>
      <div class="item">
        <div class="count">{{ realtime.monthElectricity }}</div>
        <div class="icon"></div>
        <div class="desc">当月用电</div>
      </div>
    </div>
    <div class="cell-3">
      <div class="item">
        <div class="count">{{ realtime.yesterdayElectricity }}</div>
        <div class="icon"></div>
        <div class="desc">昨日用电</div>
      </div>
      <div class="item">
        <div class="count">{{ realtime.lastMonthElectricity }}</div>
        <div class="icon"></div>
        <div class="desc">上月用电</div>
      </div>
    </div>
    <div class="center-base">
      <div class="count">{{ realtime.todayElectricity }}</div>
      <div class="desc">实时用电量(千瓦时)</div>
    </div>
  </div>
</template>
<script>
import { getRealtime } from '@/api/home/home'
export default {
  name: 'Center',
  data() {
    return {
      realtime: {}
    }
  },
  created() {
    this.getData()
  },
  methods: {
    getData() {
      getRealtime().then(response => {
        this.realtime = response.data
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.wrap {
  width: 100%;
  height: 100%;
  position: relative;
  .chain-left {
    position: absolute;
    top: 5.625rem;
    left: 0;
    width: 14.8125rem;
    height: 6.0625rem;
    background-image: url("../../../assets/images/chain-left.png");
    background-size: 100% 100%;
    .content {
      width: 100%;
      height: 2.375rem;
      padding: 0 1.75rem 0 1.25rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-family: Microsoft YaHei, Microsoft YaHei;
      font-weight: 400;
      .key {
        font-size: 0.875rem;
        color: #FFFFFF;
        display: flex;
        align-items: center;
      }
      .val {
        font-size: 1.25rem;
        color: #63DC27;
      }
    }
  }
  .chain-right {
    position: absolute;
    top: 5.625rem;
    right: 0;
    width: 14.8125rem;
    height: 6.0625rem;
    background-image: url("../../../assets/images/chain-right.png");
    background-size: 100% 100%;
    .content {
      width: 100%;
      height: 2.375rem;
      padding: 0 1.25rem 0 2.125rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-family: Microsoft YaHei, Microsoft YaHei;
      font-weight: 400;
      .key {
        font-size: 0.875rem;
        color: #FFFFFF;
        display: flex;
        align-items: center;
      }
      .val {
        font-size: 1.25rem;
        color: #DC3725;
      }
    }
  }
  .item {
    font-family: FZCuQian-M17S, FZCuQian-M17S;
    .count {
      text-align: center;
      font-weight: 400;
      font-size: 1.375rem;
      color: #73FCFD;
      text-align: center;
    }
    .icon {
      width: 7.419375rem;
      height: 5.6825rem;
      background-image: url("../../../assets/images/item-count.png");
      background-size: 100% 100%;
      margin: 1.0625rem 0 0.125rem 0;
    }
    .desc {
      font-weight: 400;
      font-size: 0.875rem;
      text-align: center;
      color: #CCCCCE;
    }
  }
  .cell-1 {
    width: 100%;
    position: absolute;
    top: 3.875rem;
    left: 0;
    display: flex;
    justify-content: center;
    .item {
      margin: 0 0.9375rem;
    }
  }
  .cell-2 {
    width: 100%;
    padding: 0 11.25rem;
    display: flex;
    justify-content: space-between;
    position: absolute;
    top: 12.375rem;
    left: 0;
  }
  .cell-3 {
    width: 100%;
    padding: 0 1.875rem;
    display: flex;
    justify-content: space-between;
    position: absolute;
    top: 20.875rem;
    left: 0;
  }
  .center-base {
    width: 43.875rem;
    height: 22.125rem;
    background-image: url("../../../assets/images/center-base.png");
    background-size: 100% 100%;
    position: absolute;
    top: 16.75rem;
    left: calc(50% - 21.9375rem);
    font-family: Microsoft YaHei, Microsoft YaHei;
    .count {
      margin: 4.6875rem 0 0.375rem 0;
      font-weight: bold;
      font-size: 1.5625rem;
      color: #73FCFD;
      text-align: center;
    }
    .desc {
      text-align: center;
      font-weight: 400;
      font-size: 0.875rem;
      color: #CCCED0;
    }
  }
}
</style>